<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>计算器</title>
	<script type="text/javascript">
		window.onload = function () {
			var oInput1 = document.getElementById("input1");
			var oInput2 = document.getElementById("input2");
			var oFuhao = document.getElementById("fuhao");
			var oBtn = document.getElementById("btn");

			oBtn.onclick = function(){
				var oNum1 = oInput1.value;
				var oNum2 = oInput2.value;
				var oVal = oFuhao.value;
				if(oNum1==""||oNum2==""){
					alert("输入框不能为空!");
					return;
				}
				if(isNaN(oNum1)||isNaN(oNum2)){
					alert("请输入数字!");
					return;
				}
				switch(oVal){

					case '0':
						alert((parseFloat(num01)*100+parseFloat(num02)*100)/100);
						break;
					case '1':
						alert((parseFloat(num01)*100-parseFloat(num02)*100)/100);
						break;
					case '2':
						alert(((parseFloat(num01)*100)*(parseFloat(num02)*100))/10000);
						break;
					case '3':
						alert((parseFloat(num01)*100)/(parseFloat(num02)*100));
						break;
				}		
				}
			}
		}
	</script>
</head>
<body>
	<h1>计算器</h1>
	<input type="text" name="" id="input1">
	<select id="fuhao">
		<option value="0">+</option>
		<option value="1">-</option>
		<option value="2">*</option>
		<option value="3">/</option>
	</select>
	<input type="text" name="" id="input2">
	<input type="button" name="" value="计算" id="btn">
</body>
</html>